<?php
namespace Todo\Controller;
use Todo\Service\LoginService;

/**
 * Class FrontendController
 * 前台应用控制器基类
 * @package Todo\Controller
 */
class FrontendController extends BaseController {

    /**
     * 前台强制登录
     * @return bool|int|mixed
     */
    protected function _login(){
        $user = LoginService::getInstance()->getLoginUser(false);
        if(!$user) $user = LoginService::getInstance()->checkToken();
        if(!$user){
            $back = __SELF__;
            session('__back', $back);
            header('Location: /login');
            die();
        }
        return $user;
    }
}